//package com.ling.pl.core.commons.springmvc;
//
//import com.ling.pl.core.commons.springmvc.constant.FailStatus;
//import com.ling.pl.core.commons.springmvc.constant.ResultField;
//import com.ling.pl.core.commons.springmvc.constant.ResultStatus;
//import org.springframework.core.MethodParameter;
//import org.springframework.stereotype.Component;
//import org.springframework.util.Assert;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.context.request.NativeWebRequest;
//import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
//import org.springframework.web.method.support.ModelAndViewContainer;
//
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * Created by bo.wang on 2016/9/27.
// */
//@Component
//public class CloudHandlerMethodReturnValueHandler implements HandlerMethodReturnValueHandler {HandlerMethodReturnValueHandler
//    @Override
//    public boolean supportsReturnType(MethodParameter methodParameter) {
//        return methodParameter.hasParameterAnnotation(RequestBody.class);
//    }
//
//    @Override
//    public void handleReturnValue(Object returnValue, MethodParameter methodParameter, ModelAndViewContainer modelAndViewContainer, NativeWebRequest nativeWebRequest) throws Exception {
//        Map<String, Object> temp=new HashMap<String, Object>();
//        if (returnValue != null||(returnValue==null&&"void".equals(methodParameter.getParameterType().toString()))) {
//            temp.put(ResultField.STATUS, ResultStatus.SUCCESS);
//            temp.put(ResultField.DATA, returnValue);
//        }else{
//            temp.put(ResultField.STATUS, ResultStatus.FAIL);
//            temp.put(ResultField.ERROCODE, FailStatus.NULLDATA);
//            temp.put(ResultField.ERROMESSAGE, "空数据");
//        }
//        returnValue=temp;
//    }
//}
